<template>
  <span @click="handleOpen()" class="news">
    <el-badge
      :value="unreadMessage?unreadMessage:''"
      :max="99">
      <i class="el-icon-message-solid"/>
    </el-badge>
    <el-dialog
      :visible.sync="box"
      v-if="box"
      title="消息"
      fullscreen
      width="100%"
      append-to-body>
      <news/>
    </el-dialog>
  </span>
</template>

<script>
import { mapGetters } from 'vuex'
import news from '@/page/news/index'
export default {
  name: 'TopNews',
  components: { news },
  data() {
    return {
      box: false
    }
  },
  created() {},
  mounted() {},
  computed: {
      ...mapGetters(['unreadMessage'])
  },
  methods: {
    handleOpen() {
      // this.box = true
      this.$router.push({
        path: '/message/page'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.news {
  cursor: pointer;
}
</style>
